<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue.js"></script>
</head>
<body>
<div id="app-2">
<button v-on:click="sayHi">click Me</button>   <!--v-on：是绑定事件的指令，后接绑定什么事件(例如：单击事件click)-->
</div>

<script>
    var vue1 = new Vue({   /*特别注意，new的Vue必须首字母大写*/
        el: "#app-2",
        data: {
            message: "狂人玩Java"
        },
        methods: { //方法必须定义在Vue的Method对象中
            sayHi: function () {
                console.log(this.message)
                alert(this.message)
            }
        }
    });

</script>
</body>
</html>
